<?php

namespace App\Http\Admin\Controllers\Config;

use App\Http\Admin\Services\Config\ConfigService;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;


class ConfigController extends Controller
{
    protected $service;
    public function __construct(ConfigService $configService)
    {
        $this->service = $configService;
    }

    /*
     * 设置配置
     * $key  键
     * $attributes 值
     * */
    public function setConf(Request $request)
    {
        $key = $request->input('key') ?? '';

        $attributes = $request->input('data') ?? '';

        $result = $this->service->setConf($key,$attributes);

        return res('设置成功',$result);
    }

    /*
     * 配置获取
     * */
    public function getConf(Request $request)
    {
        $key = $request->input('key') ?? '';


        $result = $this->service->getConf($key);

        return res('获取成功',$result);
    }


}